package com.cloud.logger.zchain.zchainserver.entity.vo;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/11/29.
 */
@Data
public class AxisVo {

    @JsonProperty("x_axis")
    @JSONField(name = "x_axis")
    @ApiModelProperty(name = "x_axis", notes = "横坐标的标签", example = "[星期一,星期二,星期三]")
    private List xaxis = new ArrayList();

    @JsonProperty("y_axis")
    @JSONField(name = "y_axis")
    @ApiModelProperty(name = "y_axis", notes = "纵坐标的单位", example = "个")
    private String yaxis;

    @JsonProperty("series")
    @JSONField(name = "series")
    @ApiModelProperty(name = "series", notes = "纵坐标的内容", example = "[1,2,3]")
    private List<AxisSeriesNode> series = new ArrayList();


    @JsonProperty("legend")
    @JSONField(name = "legend")
    @ApiModelProperty(name = "legend", notes = "图例", example = "[1,2,3]")
    private List legend = new ArrayList();

    public AxisVo(String yAxis){
        this.setYaxis(yAxis);
    }

    public void setSeries(List<AxisSeriesNode> series) {
        for(AxisSeriesNode node : series){
            this.legend.add(node.getName());
        }
        this.series = series;
    }
}
